package com.xyy.saas.payment.cores.enums;

import com.google.common.collect.Sets;

import java.util.Set;

public enum BankPayStatusEnum {
    /**
     * 银行卡支付流水状态
     */
    RECEIVED(0, "初始化状态", Sets.newHashSet(5, 6, 10, 20)),
    DEALING(5, "已接收请求", Sets.newHashSet(6, 10, 20)),
    SUSPEND(6, "暂停处理", Sets.newHashSet(10, 20)),
    SUCCESS(10, "成功", Sets.newHashSet(15)),
    REFUNDED(15, "退汇", Sets.newHashSet()),
    FAIL(20, "失败", Sets.newHashSet()),
    ;
    private int status;
    private String desc;
    private Set<Integer> nextStatus;

    BankPayStatusEnum(int status, String desc, Set<Integer> nextStatus) {
        this.status = status;
        this.desc = desc;
        this.nextStatus = nextStatus;
    }

    /**
     * 根据code查询
     *
     * @param status status
     * @return BankPayStatusEnum
     */
    public static BankPayStatusEnum fromCode(int status) {
        for (BankPayStatusEnum o : BankPayStatusEnum.values()) {
            if (status == o.status) {
                return o;
            }
        }
        return null;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Set<Integer> getNextStatus() {
        return nextStatus;
    }

    public void setNextStatus(Set<Integer> nextStatus) {
        this.nextStatus = nextStatus;
    }
}
